import {getOne} from "@/api/business/medicine";


export default {
  labelWidth: 130,
  // emptyBtn: false,
  columnBtn: false,
  height: 'auto',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  searchMenuSpan: 6,
  border: true,
  index: false,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  column: [
    {
      label: "id",
      prop: "id",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "药品ID",
      prop: "medcineId",
      type: "select",
      rules: [{
        required: true,
        message: "请输入药品ID",
        trigger: "blur"
      }],
    },
    {
      label: "药品流水号",
      prop: "medicineNo",
      type: "select",
      search: true,
      rules: [{
        required: true,
        message: "请输入药品流水号",
        trigger: "blur"
      }],
    },
    {
      label: "药品名称",
      prop: "medicineName",
      type: "select",
      search: true,
      dicUrl: "/api/retailPrice/listMedicine?medicineName={{key}}",
      filterable: true,
      remote: true,
      props: {
        label: "medicineName",
        value: "id"
      },
      change: ({column, value}) => {
        console.log(value)
        getOne(value).then(response => {
          const data = response.data.data;
          console.log(data)
          this.option.column.forEach(item => {
            this.from.medicineSecurityNo = data.insuranceCode;
            this.from.medicineNo = data.medicineNo;
            this.from.medicineId = data.id;

          })
        })
      },
      span: 24,
      rules: [{
        required: true,
        message: "请输入药品名称",
        trigger: "blur"
      }],
    },

    {
      label: "药品医保编号",
      prop: "medicineSecurityNo",
      type: "input",
      search: true,
      rules: [{
        required: true,
        message: "请输入药品医保编号",
        trigger: "blur"
      }],
    },
    {
      label: "上报药店ID",
      prop: "pharmId",
      type: "input",
      rules: [{
        required: true,
        message: "请输入上报药店ID",
        trigger: "blur"
      }],
    },
    {
      label: "上报药店名称",
      prop: "pharmName",
      type: "input",
      rules: [{
        required: true,
        message: "请输入上报药店名称",
        trigger: "blur"
      }],
    },
    {
      label: "零售价",
      prop: "price",
      type: "input",
      rules: [{
        required: true,
        message: "请输入零售价(整数或小数)",
        trigger: "blur",
        pattern: /^[0-9]+(\.[0-9]+)?$/,
      }],
    },
    {
      label: "租户id",
      prop: "tenantId",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "状态",
      prop: "status",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "创建人",
      prop: "createUser",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "创建时间",
      prop: "createTime",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "更新人",
      prop: "updateUser",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "更新时间",
      prop: "updateTime",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
    {
      label: "删除标识",
      prop: "isDeleted",
      type: "input",
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true,
    },
  ]
}
